package com.mayikt.service;

import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;

/**
 * @ClassName MeiteClassLoader
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
public class MeiteClassLoader extends ClassLoader {


    public static void main(String[] args) {
        MeiteClassLoader meiteClassLoader = new MeiteClassLoader();
        int j = 0;
        for (int i = 0; i < 10000; i++) {
//            System.out.println("第j" + (++j));
            ClassWriter classWriter = new ClassWriter(i);
            classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC, "Class" + i, null, "java/lang/Object", null);
            byte[] bytes = classWriter.toByteArray();
            meiteClassLoader.defineClass("Class" + i, bytes, 0, bytes.length);
        }
    }
}
